import React from 'react'
import ReactDOM from 'react-dom/client'
import { BrowserRouter } from 'react-router-dom'
import App from './App.jsx'
import './index.css'

// 渲染主应用
ReactDOM.createRoot(document.getElementById('root')).render(
  <React.StrictMode>
    <BrowserRouter>
      <App />
    </BrowserRouter>
  </React.StrictMode>,
)

// 初始化stagewise工具栏
const initStagewise = async () => {
  if (import.meta.env.DEV) {
    try {
      console.log('Initializing Stagewise toolbar...')
      
      // 使用基础包
      const { initToolbar } = await import('@stagewise/toolbar')
      
      // 初始化工具栏
      initToolbar({
        plugins: []
      })
      
      console.log('Stagewise toolbar initialized successfully')
      
    } catch (error) {
      console.warn('Failed to initialize Stagewise toolbar:', error)
    }
  }
}

// 延迟初始化，确保DOM完全加载
setTimeout(initStagewise, 1000) 